export default class ConditionModel {
  name: string = ''
  field: string = ''
  parseJson: boolean = false
  keyExp: string = ''
  keyPath: string = ''
  jsonValueOperator: string = ''
  jsonValue: string = ''
  jsonValueType: string = ''
  seperator: string = ''
  valueExp: string = ''
  value: string = ''
  description: string = ''

  constructor(data?: Partial<ConditionModel>) {
    if (data) {
      Object.assign(this, data)
    }
  }

  reset() {
    Object.assign(this, new ConditionModel())
  }

  update(updatedData: Partial<ConditionModel>) {
    Object.assign(this, updatedData)
  }

  validate(): boolean {
    return !!this.name && !!this.field
  }
}
